package com.caijb.redisdemo.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author caijb
 * @version 1.0
 * @data 2025/11/11 18:56
 */

@RestController
public class SentinelController {

    @SentinelResource(value = "hello", blockHandler = "blockHandler")
    @GetMapping("/hello")
    public String hello() {
        return "Hello Sentinel";
    }

    public String blockHandler(BlockException ex) {
        return "系统繁忙，请稍后再试";
    }
}
